/**
 * js中函数可以作为返回值和参数
 *  */
// 判断一个参数是否是字符串
function isString(param){
    return Object.prototype.toString.call(param) == '[object String]'
}
function isArray(param){
    return Object.prototype.toString.call(param) == '[object Array]'
}
// 函数生成
function isType(type){
    return function(param){
        return Object.prototype.toString.call(param) == `[object ${type}]`
    }
}

console.log(isType("Function")(function(){}))




function eat(){
    console.log("eat")
}
function after(timer, fn){
    let count = 0;

    return function(){
        if(++count == timer){
            fn()
        }
    }
}

let newEat = after(3, eat)
newEat()
newEat()
newEat()








